import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 终端管理信息 */
export interface UploadBatch {
          id: number; // 批次ID
          batchCode?: string; // 批次编号
          examId?: number; // 考试ID
          examName: string; // 考试名称
          subject: string; // 学科
          grade: string; // 年级
          totalCount?: number; // 试卷总数
          failedCount: number; // 上传失败数
  }

// 终端管理 API
export const UploadBatchApi = {
  // 查询终端管理分页
  getUploadBatchPage: async (params: any) => {
    return await request.get({ url: `/exam/upload-batch/page`, params })
  },

  // 查询终端管理详情
  getUploadBatch: async (id: number) => {
    return await request.get({ url: `/exam/upload-batch/get?id=` + id })
  },

  // 新增终端管理
  createUploadBatch: async (data: UploadBatch) => {
    return await request.post({ url: `/exam/upload-batch/create`, data })
  },

  // 修改终端管理
  updateUploadBatch: async (data: UploadBatch) => {
    return await request.put({ url: `/exam/upload-batch/update`, data })
  },

  // 删除终端管理
  deleteUploadBatch: async (id: number) => {
    return await request.delete({ url: `/exam/upload-batch/delete?id=` + id })
  },

  /** 批量删除终端管理 */
  deleteUploadBatchList: async (ids: number[]) => {
    return await request.delete({ url: `/exam/upload-batch/delete-list?ids=${ids.join(',')}` })
  },

  // 导出终端管理 Excel
  exportUploadBatch: async (params) => {
    return await request.download({ url: `/exam/upload-batch/export-excel`, params })
  },
}